home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
kafs20j.lzh
/
KAFS.DOC
< prev
next >
Wrap
Text File
|
1993-05-29
|
9KB
|
332 lines
KAFS - Keyed Access File System
KAFS (INCLUDING SORT) IS SHAREWARE AND MUST BE REGISTERED AFTER
A 30 DAY TRIAL PERIOD.
Overview
KAFS is a full featured file system that provides extremely fast
access times as well as a simplified interface. KAFS is a unique
file system that does not follow the traditional roles of ISAM
(Indexed Sequential Access Method), BTREE (Binary Tree), or
other such file systems. KAFS was designed to provide maximum
speed while retaining the simplicity needed to quickly design
and build applications that would use its facilities. KAFS is a
'programmer's file system'. It provides ample functions to get
the job done and provides one of the fastest file access times
of any file system available today.
What is Keyed Access?
A keyed access file system is one which performs record
searching and retrieval based on a 'key' field pertaining to the
data. Many other types of file system, such as those mentioned
above, use this methodology as well. The differences between
these systems lies in the actual processes used to search for
keys and in the data retrieval processes. Each method has is own
distinct advantages which this document will not attempt to
delve into. We will describe how KAFS functions and explain the
processes it uses to search keys and extract data from the file
system.
Simply stated, keyed access is access to records in a file based
on a key field associated with the record.
Sizing Records and Files
Record and file sizing must be done by the KAUTIL program for
all KAFS files. Records sizes defined by the KAUTIL program (in
File Create / Initialize) must EXACTLY math the record size in
the 'C' programs that will access it. Use the 'sizeof' function
to determine the size of your record structure in your 'C'
program and pass this on to the KAUTIL program when creating the
file.
File sizing is always an estimated guess of some sort. The goal
is to create a file size that will never exceed 80% of total
capacity and will yield a good hash distribution (See record
hashing explained).
See Production System Documentation .....
The KATEST program
The KATEST program gives and example of the use of KAFS. Note
that this program also uses the SORT module. To compile this
application you must compile KATEST.C, KAFS.C, and SORT.C and
link to obtain the executable KATEST.EXE. Take a look at the
program and run the executable. This will give you a good
representation of how you can use KAFS and SORT.
Note also how the 'sizeof' function is used to determine record sizes.
How KAFS Works
See Production System Documentation .....
Record Hashing Explained
See Production System Documentation .....
Hash Blocks and Overflows
See Production System Documentation .....
Using KAFS on Networks
See Production System Documentation .....
The KAUTIL Program
The KAUTIL program is a key element in the KAFS system. All KAFS
files must be created and initialized with this program before
they can be used by your 'C' program. KAFS filenames are any 8
characters (NO EXTENSIONS) that would be allowed as DOS
filenames. All KAFS files have the extension KAF. A KAFS
filename has NO EXTENSION.
Create & Initialize - Use this function to create and initialize
KAFS files. You may also use this function to re initialize
files (be careful).
File Status - Display's a KAFS file's current status.
File Re Size - Allows you to re size (smaller or larger) a KAFS
file. Use Caution.
Record Dump - Dumps a record in 'byte' format.
Directory Check - Looks for KAFS files in the designated
directory.
See Production System Documentation .....
Steps to Using the KAFS Package
Define record layouts in your 'C' program and determine record
sizes. (Use 'sizeof' function)
Use the Create & Initialize function in KAUTIL to define and
initialize each file.
Write your 'C' Code to open and access the files through KAFS.
Include KAFS.C in your compilation and link process to create
your executable.
Execute, Test, and Debug your code.
KAFS, Version 2.0 - REGISTRATION
Copyright 1991 - 1993, Dimestore Software All rights reserved
You can order or register Dimestore Software products by check
or money order.
TO: FROM:
Dimestore Software Name: _______________________________________
23121 Verdugo Dr. Suite 202
Laguna Hills, CA 92653 (Company):_______________________________________
714-581-6749 Voice (Title):_______________________________________
Address: _______________________________________
Today's
date: ___________ City, State:_______________________________________
Zip Code
Phone Number: _____________________________
KAFS System for MS-DOS
You will receive:
1. A full production Release of the product
2. A Printed Manual
3. All Related Source Code (including KAUTIL)
4. Source Code for DDWIN - Developer's Windows system
Diskette format (choose one) 5.25" disk ____ 3.5" disk ____
Diskette with programs and documentation files $39.95
Shipping & handling 4.95
California residents add 7.75% sales tax ($3.10)
Total enclosed ________
Terms:
Check or Money Order drawn on a USA Bank in US funds. Corporate
Purchase orders (net 30) accepted for software from large
corporations within the USA & Canada. All licenses must be prepaid.
Keyed Access File System Interface Specs
Global Definitions:
SOF -1 (Start of File)
OK 0 ( Status is OK)
ERR -1 ( Status is Error Occurred )
NOTFOUND -2 ( Specified record was not found )
FILEFULL -3 ( The file is full, no more records can be accepted )
KAEOF -4 ( Key Access End of File Reached on Sequential Read )
Global Variables:
int rec; - Current record number
int kaerror; - Error description value
char *kaversion - Version number of KAFS
char key[] - Holds key(string) of last record access or sets key
for next access
Key Access System Error Codes:
1 File Already Open
2 Error Attempting to Open Hash Index
3 Error Attempting to Open Data File
4 File Not Open
5 Seek Error on Data File
6 Read Error on Data File
7 Write Error on Data File
8 Error Reading Hash Index Block
9 Error Writing Hash Index Block
10 Invalid File Number
11 Key Argument Exceeds Keysize
12 File Name Invalid
13 Rec Exceeds File's Extent
Keyed Access Open, and Close Functions
ka_open(int filenumber, char *filename) - Opens the specified
file as filenumber. Filename is a KAFS filname without extension.
RETURN: OK or ERR
ka_close(int filenumber) - Close the specified filenumber.
RETURN: None
ka_close_all(void) - Closes all keyed access files.
RETURN: None
filecommit(int filenumber) - Flush a file's data to disk. Used
to insure file integrity.
RETURN: None
Keyed Access Read, Write, and Delete Functions
read_key(int filenumber, char *key, char *buffer) - If rec =
SOF then the key is hashed and the read takes place. If rec !=
SOF reads for a record based on the key field from the point of
rec. If a match is found the record is read into the buffer
specified. The 'rec' variable contains the record number.
RETURN: OK if record found, or NOTFOUND, or ERR
read_seq(int filenumber, char *buffer) - Reads the next record
in the file. Reads based on the value of 'rec'. (essentially
rec + 1). The next available record is returned regardless of
the span in record numbers. 'rec' contains the record number if
successful, and 'key' contains the key value.
RETURN: OK or KAEOF (end of file reached), or ERR
read_rec(int filenumber, char *buffer) - Reads the data portion
of the record addressed by the value of rec. This function
should only be used when the record has been previously read by
either a read_key or a read_seq call. 'key' contains the key
value.
RETURN: OK or ERR
write_key(int filenumber, char *key, void *buffer) - Writes a
new record based on the hashcode of the key field. NO CHECKING
FOR DUPLICATE RECORDS IS DONE. Files may be written with
multiple identical keys for records. 'key' must contain the
record's key value. 'buffer' must contain the record's data
record.
RETURN: OK if written, or ERR
write_upd(int filenumber, char *buffer) - Writes the data
portion of the record back into the file. Essentially does a
'write_rec' of the data. Writes into the file based on the value
of rec. Be sure 'rec' has not changed since read was performed
(or reset 'rec').
RETURN: OK if written, or ERR
rdelete(int filenumber, long delrec) - Deletes a record. The
record to be deleted must have been previously read to obtain
the correct record number.
RETURN: OK if deleted, or ERR